package org.scaffold.config;

import org.scaffold.jdbc.TableInfo;
import org.scaffold.velocity.TemplateUtils;

import java.io.IOException;
import java.sql.SQLException;

/**
 * Controller生成器助手
 */
public class ControllerOptionConfigHandle extends DomainOptionConfigHandle {

    @Override
    public void generate(MybatisGenerateConfig generateConfig) throws SQLException, IOException {
        generateConfig.generateDomain = generateConfig.generateController;
        TableInfo tableInfo = this.builder(generateConfig);
        TemplateUtils.doTemplate(tableInfo, GenerateConfig.generatePath,false,false,true,false,false);
        info("成功生成Controller，保存路径：" + GenerateConfig.generatePath);
    }
}
